import request from '@/utils/request'

export function login(data) {
  return request({
    url: '/login/',
    method: 'post',
    data
  })
}

export function regist(data) {
  return request({
    url: '/users/create/',
    method: 'post',
    data
  })
}
// # 激活接口
export function create(code) {
  return request({
    url: '/users/create/' + code + '/',
    method: 'get',
  })
}


export function getInfo(token) {
  return request({
    url: '/info/',
    method: 'get',
    params: { token }
  })
}

export function logout(token) {
  return request({
    // url: '/vue-admin-template/user/logout',
    url: '/logout/',
    method: 'get',
    params: {token}
  })
}
// 获取书籍列表
export function getBooksList(params) {
  return request({
    url: '/books/',
    method: 'get',
    params
  })
}
//查询某一个书籍
export function getBooksDetail(book_id){
  return request({
    url: '/books/'+ book_id +'/',
    method: 'get',
  })
  
}
// 书籍删除接口
export function deleteBook(book_id){
  return request({
    url: '/books/'+ book_id + '/',
    method: 'delete',
  })
}
// 编辑书籍接口
export function updateBook(book_id, data){
  return request({
    url: '/books/' + book_id + '/',
    method: 'patch',
    data
  })
}